/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-06-01 09:47:40
 * @LastEditTime : 2023-08-27 10:59:43
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\TwoRouter\EventList.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList, BuiltInData } from '../Common/common'
import { OpenThrTouter, DelDataButton, ModDataButton } from '../Common/options'

export const EventList = async ({ OptionsEvent, oneData, Permission, actionRef, ClientData }) => {
    let dataList = {
        hideInSearch: true,
        pageSize: 10,
        params: { eventListUuid: oneData.uuid },
        get: API_LIST([])['getEventDetails'],
        modify: `putEventDetails`,
        options: [
            <OpenThrTouter
                title="新增人员"
                type="primary"
                icon="add"
                modal="SelectModal"
                OptionsEvent={OptionsEvent}
                other={{
                    page: 'EventList',
                    actionRef,
                    Permission,
                    twoData: oneData,
                }}
            />,
        ],
        columns: [
            commonTableList.uuid,
            {
                title: '人员id',
                dataIndex: 'userUuid',
                search: false,
                valueType: 'hidden',
                hideInTable: true,
            },
            {
                dataIndex: 'tableName',
                title: '姓名',
                hideInAdded: true,
                hideInModify: true,
            },
            {
                dataIndex: 'eventStatus',
                title: '状态',
                valueType: 'select',
                valueEnum: BuiltInData.eventStatus,
            },
            {
                dataIndex: 'endDate',
                title: '完成时间',
                valueType: 'Date',
                showTime: true,
            },
            {
                dataIndex: 'implementation',
                title: '执行情况',
                valueType: 'input',
            },
            {
                dataIndex: 'notFinished',
                title: '未完成原因',
                valueType: 'input',
            },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 220,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        <ModDataButton OptionsEvent={OptionsEvent} key="modify" title="修改" data={record} />,
                        <DelDataButton
                            OptionsEvent={OptionsEvent}
                            key="del"
                            title="删除"
                            url="EventDetails"
                            uuid={record.uuid}
                        />,
                    ]
                },
            },
        ],
    }
    return dataList
}
